package com.cheng.service;

import com.cheng.dao.OrderMapper;
import com.cheng.pojo.Order;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import java.util.Date;
import java.util.List;

public class OrderServiceImpl implements OrderService {
    //service调dao层:组合Dao
    private OrderMapper orderMapper;
    public void setOrderMapper(OrderMapper orderMapper) {
        this.orderMapper=orderMapper;
    }


//    public List<Order> querymerchantsOrder(String userCode) {
//        return orderMapper.querymerchantsOrder(userCode);
//    }



    public PageInfo<Order> querymerchantsOrder(int page, int pageSize, String userCod ) {
        PageHelper.startPage(page, pageSize);
        List<Order> list = orderMapper.querymerchantsOrder(userCod);
        PageInfo<Order> pageInfo = new PageInfo<Order>(list);

        return pageInfo;
    }

    @Override
    public PageInfo<Order> queryusersOrder(int page, int pageSize, String name) {
        PageHelper.startPage(page, pageSize);
        List<Order> list = orderMapper.queryusersOrder(name);
        PageInfo<Order> pageInfo = new PageInfo<Order>(list);

        return pageInfo;
    }

    public int merchantsDeleteOrder(String ordercode) {
        return orderMapper.merchantsDeleteOrder(ordercode);
    }

    @Override
    public int addOrder(String ordername, Date qwer, String usercode, String Child_number, String Adult_number, String total_price, String name,String productcode,int cno) {
        return orderMapper.addOrder(ordername,qwer,usercode,Child_number,Adult_number,total_price,name,productcode,cno);
    }
}
